package com.company.cloud.mall.modules.mgr.controller.req;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;

import com.company.cloud.common.bean.BaseParam;

import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
public class OrderSendParam extends BaseParam{

	
	@ApiModelProperty(value = "订单流水号" ,required = true)
	@NotEmpty(message = "订单流水号不能为空")
    private String orderSn;
	
	@ApiModelProperty(value = "运单号")
    private String trackingNo;
	
    @ApiModelProperty(value = "物流公司名称")
    private String deliveryCorpName;

    @ApiModelProperty(value = "物流公司编号")
    private String deliveryCorpCode;

    @ApiModelProperty(value = "物流费用")
    private BigDecimal freight;

    @ApiModelProperty(value = "备注")
    private String memo;
    
    @ApiModelProperty(value = "发货明细" ,required = true)
    @NotNull(message = "发货明细不能为空")
    private List<OrderSendItem> items;
    
    public void addItem(OrderSendItem item) {
    	if(this.items==null) {
    		this.items=new ArrayList<OrderSendItem>();
    	}
    	if(item!=null) {
    		this.items.add(item);
    	}
    }
    
//    public Map<Integer, Integer> getItemMap(){
//    	Map<Integer, Integer> map=new HashMap<Integer, Integer>();
//    	items.forEach(item->{
//    		map.put(item.getOrderItemId(), item.getQuantity());
//    	});
//    	return map;
//    }
	
}
